Intelligent caching data structure for immediate mode graphics

ABSTRACT

An intelligent caching data structure and mechanisms for storing visual information via objects and data representing graphics information. The data structure is generally associated with mechanisms that intelligently control how the visual information therein is populated and used. The cache data structure can be traversed for direct rendering, or traversed for pre-processing the visual information into an instruction stream for another entity. Much of the data typically has no external reference to it, thereby enabling more of the information stored in the data structure to be processed to conserve resources. A transaction/batching-like model for updating the data structure enables external modifications to the data structure without interrupting reading from the data structure, and such that changes received are atomically implemented. A method and mechanism are provided to call back to an application program in order to create or re-create portions of the data structure as needed, to conserve resources.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present invention claims priority to U.S. Provisional PatentApplication Ser. No. 60/330,418, filed Oct. 18, 2001. The presentinvention is related to United States Patent Applications entitled“Generic Parameterization for a Scene Graph” and “Multiple-LevelGraphics Processing System and Method”, assigned to the assignee of thepresent application, filed concurrently herewith, and herebyincorporated by reference in their entireties.

FIELD OF THE INVENTION

The invention relates generally to computer systems, and moreparticularly to the processing of graphical and other video informationfor display on computer systems.

BACKGROUND OF THE INVENTION

In contemporary computing systems, the capability of graphics and videohardware is growing at a fast pace. In fact, to an extent, the graphicssystem in contemporary computing systems may be considered more of acoprocessor than a simple graphics subsystem. At the same time,consumers are expecting more and more quality in displayed images,whether viewing a monitor, television or cellular telephone display, forexample. However, memory and bus speeds have not kept up with theadvancements in main processors and/or graphics processors.

As a result, the limits of the traditional immediate mode model ofaccessing graphics on computer systems are being reached. At the sametime, developers and consumers are demanding new features and specialeffects that cannot be met with traditional graphical windowingarchitectures.

Although certain game programs have been designed to take advantage ofthe graphics hardware, such game programs operate with differentrequirements than those of desktop application programs and the like,primarily in that the games do not need to be concerned with otherprograms that may be concurrently running. Unlike such game programs,applications need to share graphics and other system resources withother applications. They are not, however, generally written in acooperative, machine-wide sharing model with respect to graphicsprocessing.

For example, performing animation with desktop applications currentlyrequires specialized single-purpose code, or the use of anotherapplication. Even then, achieving smooth animation in a multiplewindowed environment is difficult if not impossible. In general, this isbecause accomplishing smooth, high-speed animation requires updatinganimation parameters and redrawing the scene (which requires traversingand drawing data structures) at a high frame rate, ideally at thehardware refresh rate of the graphics device. However, updatinganimation parameters and traversing and drawing the data structures thatdefine a scene are generally computationally-intensive. The larger ormore animate the scene, the greater the computational requirement, whichlimits the complexity of a scene that can be animated smoothly.

Compounding the problem is the requirement that each frame of theanimation needs to be computed, drawn, and readied for presentation whenthe graphics hardware performs a display refresh. If the frame is notready when required by the hardware, the result is a dropped or delayedframe. If enough frames are dropped, there is a noticeable stutter inthe animated display. Also, if the frame preparation is not synchronizedwith the refresh rate, an undesirable effect known as tearing may occur.In practice, contemporary multi-tasking operating systems dividecomputational resources among the many tasks on the system. However, theamount of time given for frame processing by the operating system taskscheduler will rarely align with the graphics hardware frame rate.Consequently, even when sufficient computational resources exist, theanimation system may still miss frames due to scheduling problems. Forexample, an animation task may be scheduled to run too late, or it mayget preempted before completing a frame, and not be rescheduled in timeto provide a next frame for the next hardware refresh of the screen.These problems get even more complex if the animated graphics need to becomposited with video or other sources of asynchronously generatedframes.

In general, the current (e.g., WM_PAINT) model for preparing the framesrequires too much data processing to keep up with the refresh rate whencomplex graphics effects (such as complex animation) are desired. As aresult, when complex graphics effects are attempted with conventionalmodels, instead of completing the changes in the next frame that resultin the perceived visual effects in time for the next frame, the changesmay be added over different frames, causing results that are visuallyand noticeably undesirable. There are computing models that attempt toallow the changes to be put in selectively, by providing object handlesto every object in the scene graph. Such models, however, requireapplications to track a significant number of objects, and also consumefar too many resources, as the object handles are present even when theapplication does not want to make changes to the objects.

In summary, existing models of accessing graphics on computer systemsare becoming inadequate for working with current display hardware andsatisfying consumer expectations. A new model for processing graphicsand video is needed.

SUMMARY OF THE INVENTION

Briefly, the present invention provides an intelligent caching datastructure and mechanism for storing visual information. The intelligentcaching data structure may be filled with objects and data representinggraphics information, and is otherwise generally associated withmechanisms that intelligently control (e.g., optimize) how the visualinformation therein is populated and used.

The cache data structure can be traversed for direct rendering, (e.g.,to render it to a bitmap to be sent over the network to a web browser,or to render it to a memory surface to interchange with legacy programs,systems or devices), or traversed for pre-processing the visualinformation therein into an instruction stream or the like that can befed to a lower level system that performs faster compositing andanimation. The data structure can also be pre-processed in other ways,such as to be sent across a network to a remote terminal, or to be sentto a printer.

The data structure includes data and other structures provided by anapplication program or the like, with much of the data typically havingno external reference thereto. Such restricted, “write only” access tothe structure via limited identity enables more of the informationstored in the data structure to be optimized or otherwise processed,such as to conserve resources. For example, by not providing a handle tothe data unless specifically requested by the application, the data inthe cache data structure can be changed/processed into a differentformat that saves resources, such as a format that is more compact, orone that reduces or eliminates the need for subsequent, repeatedprocessing, e.g., a bitmap or other post-processing result.

Also provided via the cache is a transaction/batching-like model forupdating the data structure, which enables external modifications to thedata structure to be done without interrupting reading from the datastructure. The transaction/batching-like model also allows multiplechanges to appear on the screen at once. By batching changes to multiplecontainers, multiple changes in different parts of the data structureappear on the screen at once. In one alternative, thetransaction/batching model may be synchronized with the render thread.In another alternative, changes received to a container are queuedatomically following the close of that container, and possibly others.

A method and mechanism are provided to call back to the application (orother higher-level) program code in order to create or re-createportions of the data structure as needed. Such an invalidation methodenables resources to be conserved and/or reclaimed. For example,resources that may be needed in the future may be marked invalid suchthat they need not be allocated unless and until actually needed.Similarly, resources (e.g. memory) reserved for currently unneeded partsof the data structure may be reclaimed by marking the correspondingcontainer or containers invalid, and via the invalidation method andmechanism, filled in only if later needed.

The present invention may be provided via a system andcomputer-executable components comprising, a cache that maintains visualinformation, a queue for maintaining changes to the visual informationas requested by higher level program code, an interface to the cachethrough which the visual information is accessed by the program code,the program code accessing the visual information via the interface,including requesting access to a container in the cache, a drawingcontext that opens the container and provides a surface through whichthe program code requests changes to data in the container, and abatching mechanism, the batching mechanism deferring the writing of anychange to the queue until at least the close of the container, such thatchanges to the container occur as an atomic operation.

A method and computer-readable medium having computer-executableinstructions may include maintaining a scene graph, receiving a firstrequest to implement a first change in a structure of the scene graph,receiving a second request to implement a second change in thestructure, and implementing the changes to the first and second dataatomically by making the changes only upon receipt of an instructionthat requests implementation of the changes. Another method andcomputer-readable medium having computer-executable instructions mayinclude receiving data corresponding to a scene graph, the dataincluding a first set of the data without an external reference to thedata, changing at least part of the first set of data to changed data ina different format, and maintaining the changed data in the scene graph.Another method and computer-readable medium having computer-executableinstructions may include receiving data corresponding to a scene graph,determining that the data does not require an external referencethereto, and maintaining the data in the scene graph without an externalreference thereto.

A system and computer-executable components may comprise a cache in thememory that maintains visual information including data and containersin a format that is independent of a receiving entity, a renderingmechanism that traverses the cache to provide processed data, theprocessed data corresponding to a format understood by a receivingentity, and the receiving entity receiving the instruction stream andproducing the visible output therefrom. A method and computer-readablemedium having computer-executable instructions may include maintainingvisual information in a cache data structure including containers anddata, determining when at least one container is not needed forproviding visual information corresponding thereto when rendered,marking the container as invalid and reclaiming at least some of theresources associated with maintaining the container. Another method andcomputer-readable medium having computer executable instructions mayinclude maintaining visual information in a cache data structureincluding containers and data, reserving an invalid container forstoring graphics information, without having space allocated for thegraphics information and rendering the data structure into data forreceipt by another entity, including determining whether the graphicsinformation of the invalid container is needed, and if so, allocatingresources for the graphics information, calling back to higher-levelprogram code to provide the graphics information, receiving the graphicsinformation, and outputting the data for receipt by another entityincluding information corresponding to the graphics informationreceived.

Other benefits and advantages will become apparent from the followingdetailed description when taken in conjunction with the drawings, inwhich:

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram representing an exemplary computer system intowhich the present invention may be incorporated;

FIG. 2 is a block diagram representing one example architecture intowhich the present invention may be incorporated;

FIG. 3 is a block diagram representing an intelligent caching datastructure and its relationship to various components in accordance withone aspect of the present invention;

FIG. 4 is a block diagram representing the general flow of controlbetween a high-level composition and animation engine and other levels,including a change queue alternative, in accordance with one aspect ofthe present invention;

FIG. 5 is a block diagram representing example containers and othernodes cached in a simple data structure and their relationships inaccordance with one aspect of the present invention;

FIG. 6 is a block diagram representing general components of a low-levelcomposition and animation engine interacting with other components inaccordance with one aspect of the present invention;

FIG. 7 is a block diagram representing general components of thelow-level composition and animation engine in accordance with one aspectof the present invention;

FIG. 8 is a block diagram representing logical structure of a connectionto the low-level composition and animation engine in accordance with oneaspect of the present invention; and

FIG. 9 comprises example data structures that may be used to communicateinformation rendered from the cache data structure to another entitysuch as a low-level composition and animation engine in accordance withone aspect of the present invention.

DETAILED DESCRIPTION

Exemplary Operating Environment

FIG. 1 illustrates an example of a suitable computing system environment100 on which the invention may be implemented. The computing systemenvironment 100 is only one example of a suitable computing environmentand is not intended to suggest any limitation as to the scope of use orfunctionality of the invention. Neither should the computing environment100 be interpreted as having any dependency or requirement relating toany one or combination of components illustrated in the exemplaryoperating environment 100.

The invention is operational with numerous other general purpose orspecial purpose computing system environments or configurations.Examples of well known computing systems, environments, and/orconfigurations that may be suitable for use with the invention include,but are not limited to, personal computers, server computers, hand-heldor laptop devices, tablet devices, multiprocessor systems,microprocessor-based systems, set top boxes, programmable consumerelectronics, network PCs, minicomputers, mainframe computers,distributed computing environments that include any of the above systemsor devices, and the like.

The invention may be described in the general context ofcomputer-executable instructions, such as program modules, beingexecuted by a computer. Generally, program modules include routines,programs, objects, components, data structures, and so forth, whichperform particular tasks or implement particular abstract data types.The invention may also be practiced in distributed computingenvironments where tasks are performed by remote processing devices thatare linked through a communications network. In a distributed computingenvironment, program modules may be located in both local and remotecomputer storage media including memory storage devices.

With reference to FIG. 1, an exemplary system for implementing theinvention includes a general purpose computing device in the form of acomputer 110. Components of the computer 110 may include, but are notlimited to, a processing unit 120, a system memory 130, and a system bus121 that couples various system components including the system memoryto the processing unit 120. The system bus 121 may be any of severaltypes of bus structures including a memory bus or memory controller, aperipheral bus, and a local bus using any of a variety of busarchitectures. By way of example, and not limitation, such architecturesinclude Industry Standard Architecture (ISA) bus, Micro ChannelArchitecture (MCA) bus, Enhanced ISA (EISA) bus, Video ElectronicsStandards Association (VESA) local bus, Accelerated Graphics Port (AGP)bus, and Peripheral Component Interconnect (PCI) bus also known asMezzanine bus.

The computer 110 typically includes a variety of computer-readablemedia. Computer-readable media can be any available media that can beaccessed by the computer 110 and includes both volatile and nonvolatilemedia, and removable and non-removable media. By way of example, and notlimitation, computer-readable media may comprise computer storage mediaand communication media. Computer storage media includes both volatileand nonvolatile, removable and non-removable media implemented in anymethod or technology for storage of information such ascomputer-readable instructions, data structures, program modules orother data. Computer storage media includes, but is not limited to, RAM,ROM, EEPROM, flash memory or other memory technology, CD-ROM, digitalversatile disks (DVD) or other optical disk storage, magnetic cassettes,magnetic tape, magnetic disk storage or other magnetic storage devices,or any other medium which can be used to store the desired informationand which can accessed by the computer 110. Communication mediatypically embodies computer-readable instructions, data structures,program modules or other data in a modulated data signal such as acarrier wave or other transport mechanism and includes any informationdelivery media. The term “modulated data signal” means a signal that hasone or more of its characteristics set or changed in such a manner as toencode information in the signal. By way of example, and not limitation,communication media includes wired media such as a wired network ordirect-wired connection, and wireless media such as acoustic, RF,infrared and other wireless media. Combinations of the any of the aboveshould also be included within the scope of computer-readable media.

The system memory 130 includes computer storage media in the form ofvolatile and/or nonvolatile memory such as read only memory (ROM) 131and random access memory (RAM) 132. A basic input/output system 133(BIOS), containing the basic routines that help to transfer informationbetween elements within computer 110, such as during start-up, istypically stored in ROM 131. RAM 132 typically contains data and/orprogram modules that are immediately accessible to and/or presentlybeing operated on by processing unit 120. By way of example, and notlimitation, FIG. 1 illustrates operating system 134, applicationprograms 135, other program modules 136 and program data 137.

The computer 110 may also include other removable/non-removable,volatile/nonvolatile computer storage media. By way of example only,FIG. 1 illustrates a hard disk drive 141 that reads from or writes tonon-removable, nonvolatile magnetic media, a magnetic disk drive 151that reads from or writes to a removable, nonvolatile magnetic disk 152,and an optical disk drive 155 that reads from or writes to a removable,nonvolatile optical disk 156 such as a CD ROM or other optical media.Other removable/non-removable, volatile/nonvolatile computer storagemedia that can be used in the exemplary operating environment include,but are not limited to, magnetic tape cassettes, flash memory cards,digital versatile disks, digital video tape, solid state RAM, solidstate ROM, and the like. The hard disk drive 141 is typically connectedto the system bus 121 through a non-removable memory interface such asinterface 140, and magnetic disk drive 151 and optical disk drive 155are typically connected to the system bus 121 by a removable memoryinterface, such as interface 150.

The drives and their associated computer storage media, discussed aboveand illustrated in FIG. 1, provide storage of computer-readableinstructions, data structures, program modules and other data for thecomputer 110. In FIG. 1, for example, hard disk drive 141 is illustratedas storing operating system 144, application programs 145, other programmodules 146 and program data 147. Note that these components can eitherbe the same as or different from operating system 134, applicationprograms 135, other program modules 136, and program data 137. Operatingsystem 144, application programs 145, other program modules 146, andprogram data 147 are given different numbers herein to illustrate that,at a minimum, they are different copies. A user may enter commands andinformation into the computer 20 through input devices such as a tablet(electronic digitizer) 164, a microphone 163, a keyboard 162 andpointing device 161, commonly referred to as mouse, trackball or touchpad. Other input devices (not shown) may include a joystick, game pad,satellite dish, scanner, or the like. These and other input devices areoften connected to the processing unit 120 through a user inputinterface 160 that is coupled to the system bus, but may be connected byother interface and bus structures, such as a parallel port, game portor a universal serial bus (USB). A monitor 191 or other type of displaydevice is also connected to the system bus 121 via an interface, such asa video interface 190. The monitor 191 may also be integrated with atouch-screen panel 193 or the like that can input digitized input suchas handwriting into the computer system 110 via an interface, such as atouch-screen interface 192. Note that the monitor and/or touch screenpanel can be physically coupled to a housing in which the computingdevice 110 is incorporated, such as in a tablet-type personal computer,wherein the touch screen panel 193 essentially serves as the tablet 164.In addition, computers such as the computing device 110 may also includeother peripheral output devices such as speakers 195 and printer 196,which may be connected through an output peripheral interface 194 or thelike.

The computer 110 may operate in a networked environment using logicalconnections to one or more remote computers, such as a remote computer180. The remote computer 180 may be a personal computer, a server, arouter, a network PC, a peer device or other common network node, andtypically includes many or all of the elements described above relativeto the computer 110, although only a memory storage device 181 has beenillustrated in FIG. 1. The logical connections depicted in FIG. 1include a local area network (LAN) 171 and a wide area network (WAN)173, but may also include other networks. Such networking environmentsare commonplace in offices, enterprise-wide computer networks, intranetsand the Internet.

When used in a LAN networking environment, the computer 110 is connectedto the LAN 171 through a network interface or adapter 170. When used ina WAN networking environment, the computer 110 typically includes amodem 172 or other means for establishing communications over the WAN173, such as the Internet. The modem 172, which may be internal orexternal, may be connected to the system bus 121 via the user inputinterface 160 or other appropriate mechanism. In a networkedenvironment, program modules depicted relative to the computer 110, orportions thereof, may be stored in the remote memory storage device. Byway of example, and not limitation, FIG. 1 illustrates remoteapplication programs 185 as residing on memory device 181. It will beappreciated that the network connections shown are exemplary and othermeans of establishing a communications link between the computers may beused.

Media Integration Layer Architecture

One aspect of the present invention is generally directed to leveragingmore of the power of the graphics hardware that is present on typicalcomputer systems. To this end, as generally presented in FIG. 2, a mediaintegration layer architecture 200 is provided. An application, controlor other similar higher-level program code (e.g., a user interface of anoperating system component) 202 accesses the media integration layerarchitecture 200 via a set of application programming interfaces (APIs)204 or the like, to access (write or read) graphical information. Notethat although many of the examples described herein will refer to anapplication program interfacing with the APIs, it is understood thatother higher-level program code and components (e.g., a user interfaceof the operating system) will also be able to interface with the lowerlevel components described herein. As such, any reference to suchhigher-level program code, whether referred to as an applicationprogram, user interface, and so on, should be considered equivalent.

It should be noted that for various reasons including security, themedia integration layer 200 (which outputs graphics) is preferablyincorporated into the operating system. For example, while feasible toallow some or part of the media integration layer 200 to be insertedbetween the application and the operating system, doing so would enablea malicious program to display whatever graphics it wanted, and therebycause harm. For example, malicious code could display a dialog boxrequesting entry of a password to thereby steal a user's password. Otherreasons for incorporating the media integration layer 200 into theoperating system include stability and efficiency, e.g., the lowerlevels can efficiently trust that the data and instructions from thehigher layers are already verified. Further, the lower levels can exposeinterfaces that only the operating system is trusted to callresponsibly, that is, without exposing those interfaces to unpredictableprograms, thereby ensuring greater stability.

In one implementation, the media integration layer architecture 200includes a high-level composition and animation engine 206, timing andanimation components 208, and a low-level compositing and animationengine 210. As used herein, the terms “high-level” and “low-level” aresimilar to those used in other computing scenarios, wherein in general,the lower a software component relative to higher components, the closerthe component is to the hardware. Thus, for example, graphicsinformation sent from the high-level composition and animation engine206 may be received at the low-level compositing and animation engine210, where the information is used to send graphics data to the graphicssubsystem including the hardware.

As described below, the high-level composition and animation engine(also referred to herein as the high-level compositor and animator orthe high-level engine or component) 206 builds a display tree torepresent a graphics scene provided by the application program 202,while the timing and animation components provide declarative (or other)animation and timing control. As also described below, the low-levelcompositing and animation engine (also referred to herein as thelow-level compositor and animator or low-level engine or component) 210composes the renderings for the scenes of multiple applications, andwith rendering components, also referred to renderers, implement theactual rendering of graphics to the screen. Note, however, that at timesit may be necessary and/or advantageous for some of the rendering tohappen at higher levels. For example, while the lower layers servicerequests from multiple applications, the higher layers are instantiatedon a per application basis, whereby is possible to do time consuming orapplication-specific rendering at a higher levels, and pass referencesto a bitmap to the lower layers.

In accordance with the present invention and as described below, apreferred display tree comprises an intelligent caching data structure,e.g., filled with objects and data and otherwise generally associatedwith mechanisms that intelligently control (e.g., optimize) how thevisual information therein is populated and used. In general, thehigh-level composition and animation engine 206, along with higher levelprogram code 202, builds the display structure and traverses thestructure creating rendering instructions and simple animation intervalsto be passed to the low-level compositing and animation engine 210. Therendering instructions generated by the high level compositor maycontain timing and animation information. The low-level compositing andanimation engine 210 takes the rendering instructions and animationintervals and manages the animating, rendering and composing the scenethat is then provided to the graphics subsystem (e.g., the graphicssoftware and hardware) 212.

Alternatively or in addition to locally displayed output, the high-levelcomposition and animation engine 206 (or one similar thereto) mayprovide the rendering and animation instructions in an appropriateformat to lower-level printing code 220 for sending fixed image data toa printer 222 or the like, and/or may provide rendering instructions andsimple animation intervals in an appropriate format to a lower-levelterminal transport server 226 for transmission to remote machines 228.Note that richer information also may be passed across the network,e.g., it may be desirable to have the remote machine handle mouserollover effects locally, without any network traffic.

Multiple Graphics Processing Levels

Although not necessary to the present invention, in one implementation,the media integration layer architecture 200 thus separates graphicsprocessing into multiple levels. Each of these levels performs someintelligent graphics processing which together allows applications, userinterfaces and the like 202 to output graphics with smooth animation,composite the graphics with the graphics of other applications and withvideo frames. The animation and/or compositing may also be synchronizedwith audio output. For example, by synchronizing audio with the framerate at the low level component, the timing of audio can essentially beexact with that of video or graphics, and not dependent on the abilityof task-scheduled, complex pre-processing to keep up with the refreshrate.

In accordance with one aspect of the present invention, and as generallyrepresented in FIG. 3, below the application 202 as communicated withvia the APIs 204, the high-level compositor and animator engine 206caches the application graphical data in a tree structure 300,pre-processes the data in an intelligent manner, and performs numerousother operations (described below) to facilitate the output of complexgraphics. In one, multiple-level implementation, the high-levelcompositor and animator engine 206 performs complex processing(sometimes referred to as compiling) that significantly simplifies theamount of processing and significantly reduces the amount of data thatother, lower levels need to deal with to render the correct output.Note, however, that the amount and type of processing that is performedby the higher level may be dependent to a significant extent on theload, configuration and capabilities of the lower levels. For example,if high capability graphics hardware is present, the higher level may doa lesser amount of processing, and vice-versa. The high-level andlow-level layers are adaptive to these factors.

In keeping with the present invention, the high-level composition andanimation engine 206 can accomplish such complex processing withoutoverwhelming the available system resources because it operates at arelatively slower rate than the level or levels below. By way ofexample, and not limitation, the lower levels may operate at the frame(refresh) rate of the hardware graphics processor. For example, thehigh-level compositor and animator 206 may only operate when needed toeffect a display change, on demand, or on another schedule (e.g., everyhalf second). Note that while a single high-level compositor andanimator engine 206 is represented in FIG. 3, there may be multipleinstances of them, such as one per application, while there is typicallyonly one low-level compositing and animation engine 210 per graphicsdevice, e.g., one for each graphics hardware card on a machine.

Moreover, the high-level compositor and animator 206 can tailor itsoutput to (or be designed to output) a format of the appropriate levelor levels below, e.g., essentially any abstract device 302. For example,the high-level compositor and animator 206 can produce compiled outputthat is ultimately destined for a printer, for transmission over anetwork to a number of remote terminals for display thereon, or for thelower-level compositor and animator 210 that is present above localgraphics software and hardware 212. A single high-level compositor andanimator may process the output of an application for a plurality ofabstract devices, or there may be a suitable instance of a high-levelcompositor and animator to process the output of an application for eachtype of abstract device, e.g., one for local graphics, one for a printerand one for a terminal server.

Further, the commands and other data provided by the high-levelcompositor and animator 206 can be simplified to match the capabilitiesand requirements of the hardware, e.g., the lesser the hardware, themore high-level pre-processing needed. Still further, the amount ofhigh-level pre-processing may be dynamic, e.g., so as to adjust to thevarying processing demands placed on the lower level or levels.

For local graphics output, in one configuration the media integrationlayer architecture 200 includes the high-level compositor and animator206, and the low-level compositor and animator 210. As will be describedbelow, in general, the high-level compositor and animator 206 performscomplex processing of graphics information received from clients (e.g.,applications) to build graphics structures and convert these structuresinto a stream of graphics commands. The low-level engine 210 then usesthe streams of graphics commands from various clients to compose thedesktop that is viewed by the computer user, e.g., the low-levelcompositor composes the desktop by combining the command streams emittedby the various clients present on the desktop into graphics commandsconsumed by a graphics compositing engine.

In this implementation, the high-level compositor and animator 206performs the complex processing operations that build and convert thestructures 300 into the stream of graphics commands at a rate (which maybe only on demand) that is normally much slower than the hardwarerefresh rate of the graphics hardware of the graphics subsystem 212. Asa result of this high-level pre-processing, the low-level engine 210 isable to perform its own processing operations within the hardwarerefresh interval of the graphics hardware of the graphics subsystem 212.As mentioned above, however, the low-level engine 210 can communicateback to the high-level engine 206 over a back channel so that thehigh-level pre-processing can dynamically adjust to the low-levelprocessing demands. Note that the back-channel from the low-levelcompositor and animator 206 to the high-level compositor and animator206 is primarily for communicating flow control (the low-level engine210 signaling it needs more data or is receiving too much) to the highlevel engine 206 and/or error conditions actionable by the high levelengine 206. One advantage of such communication is that the low-levelcompositing and animation engine 210 need not be concerned withpriorities or scheduling, but can remain in synchronization with therefresh rate. Instead, the high-level CPU process scheduling alreadypresent in contemporary operating systems will control priority. Thus,for example, if an application process attempts to take too much of itsshare of high-level graphics pre-processing relative to its priority, itwill be that application that is adversely affected in its output. Note,however, that when the low-level system is under heavy load, it canchoose to prioritize the changes and demands of one process/high-levelcomponent over another. For example, the foreground application can begiven priority.

The High-level Compositor and Animator

In one embodiment, the media integration layer 200 including thehigh-level compositor and animator 206 adjusts for hardware differenceson a given machine, because each user application cannot realisticallybe written to handle the many types and variations of graphics hardware.However, applications may also contribute to the improved graphicsprocessing provided by the media integration layer 200, namely byproviding more (and different) information to the high-level compositorand animator 206 than that presently passed to an operating system'sgraphics APIs. For example, applications that are aware of the mediaintegration layer 200 may provide different data, including animationintentions and the like via the media integration layer APIs 202. By wayof example, instead of performing animation by continually redrawing aslightly varied image, the application can provide an instruction as tohow a particular image should move over time, e.g., relative to a fixedbackground. The media integration layer 200 then handles the automationin a smoothly rendered way.

In general, as represented in FIGS. 3 and 4, the application 202 buildsa scene graph data structure via APIs 204. The data includes high levelstructure (e.g., containers) and primitive data, and is put into a cachedata structure 300 that is used to intelligently cache visualinformation.

One of the objects (or structures) in the overall intelligent cachingdata structure 300 is a container, represented in FIG. 4 by containers402, 404 or 408, (alternatively referred to as a Visual2D). In oneimplementation, a container (e.g., 404) provides identity in that anapplication can hold a handle to it, and includes procedural parameterswhich can be used for hooking up animation and templating, hit-testingand user data. Note however that the containers represented herein arenot the only types of containers that might be exposed. Other examplesmay include containers that are optimized for storing lines in aparagraph or for storing many children in a grid. Children containersmay be added and removed without clearing the current list of children,although certain types of containers may not allow random access to thechildren. The structure exposed through the API can be adapted asneeded.

Other (internal) nodes of this data structure include transforms 406,alpha nodes, cache nodes, and primitive nodes 410, 412, used to storeinternal data not directly associated with an API container. Primitivesare generally stored as a stream of instructions that can be passeddirectly to the graphics device.

As represented in the tree segment 500 of FIG. 5, a container such as510 can thus hold other containers 512 or drawing primitives 516,wherein storage of the primitives inside of any container can beconsidered a stream of graphics instructions. A container can also storeother containers, in effect creating a graph, i.e., containers can bereferenced by more than one container so that the data structure is adirected acyclic graph (DAG) of containers and lists of primitives(wherein no container can contain one of its parent containers). As alsorepresented in FIG. 5, by allowing trees to reference other trees in agraph-like way, any of the containers, such as the container 518 in thetree segment 502 may be reused in different places, yet with differentparameters.

A container is populated via an open/close pattern, such as generallyrepresented in the drawing context 416 of FIG. 4. More particularly, thehigher level code 202 opens a container 408 in the data structure,provides the drawing context 416 to write drawing primitives and/or addother containers into the data structure, and then closes the container408. In one alternative implementation, when the container is closed,its data is put into a change queue 418 that is then applied at somelater time. The opening and closing of containers is one of the mainmechanisms for changing the data structure. Note that other usagepatterns may be employed, particularly for different types ofcontainers.

In accordance with one aspect of the present invention, because thechanges to the data structure are put into a queue or the like, atransaction-like (or batch-like) system for updating the data structureis enabled. As a result, when opening and writing to a container, nochanges are apparent on the screen until the container is closed. Thechanges to the screen are atomic and there are no temporal artifacts(also referred to as structural tearing) of a partially drawn screen.Further, such transactional behavior can be extended so that changes tomultiple containers are applied at once. In this way the higher levelcode 202 can set up many changes to a scene and apply those changes allat once.

In one alternative implementation, changes to the data structure aremade asynchronously by posting changes to the queue 418 via a displaymanager 420, such that the changes will be processed on a renderingthread 422, and for example, sent to the low level compositor andanimator 210, (wherein the abstract device 302 of FIG. 3 comprises theabstraction that encapsulates the conversion of rendering commandsissued by the high level compositor 206 into rendering commands streamedto the low level compositor 210). The transaction-like model alsoenables modifications to the data structure to be made withoutinterrupting reading from the data structure.

Although the above-described queue model enables the read passes fromthe high-level engine 206 to run independent of any actions that theuser takes, user applications need the cache to maintain a consistentview of the APIs, which may lead to inefficiencies. By way of example,consider a user application on the main user thread setting a propertyon a container (object in the high-level engine 206). In the queuemodel, this property gets put into a queue to be applied to thehigh-level engine 206 data structure. However, if the user applicationtries to immediately read back that property from the container, thesystem will need to read the property back based on what is currently inthe queue (which is inefficient), synchronize with the rendering threadand apply the pending changes in the queue (which is inefficient andwould negate the benefits of having the queue), or keep copies of userchangeable data, both the render version and the pending version, on thecontainer (which is an inefficient use of memory).

Because there may be a considerable amount of reading back byapplications, an alternative implementation essentially eliminates thequeue by synchronizing the updating of the high-level engine 206 datastructures and the main user thread. Although this enables the userapplication to freeze the rendering, the overall system is moreefficient. However, to mitigate the perceived effects of possiblefreezing, various parts of the animation and timing system may be runindependently to communicate information down to the low-level engine210, while trusting the low-level engine 210 to do more animationprocessing independent of the high-level engine 206. Then, if thehigh-level engine 206 is frozen because of a user action, the output tothe screen will still be relatively smooth and consistent.

Yet another alternative is to eliminate the render thread, and have themain user thread perform any processing necessary for the high-levelengine 206 to pass the rendering instructions to the low-level engine210. This is a more efficient use of threads in some cases.

Returning to FIG. 4, the container 408 comprises a basic identity nodethat contains drawing primitives, while the draw context 416 comprises agraph builder (e.g., a helper object) obtained from a container that canbe used to add primitives, transforms, clips or other drawing operationsto the container. The display manager 420 comprises a hosting objectthat represents an instance of the high-level compositor and animator206, and for example, can attach to an hwnd (handle to a window) or anhvisual (handle to a visual container). The display manager 420 has apointer to the root container 402 for the scene, dispatches events tothe high level code when containers are invalid and need to be redrawn,and provides access to services such as hit testing and coordinatetransforms.

In accordance with another aspect of the present invention, although thehigher level code 202 can hold a handle or the like to some of theobjects in the data structure and containers, most of the objects in thecontainer do not have an identity from the perspective of theapplication. In particular, access to this structure is restricted inthat most usage patterns are “write only.” By limiting identity in thismanner, more of the information stored in the data structure can beoptimized, and the higher level code 202 does not have to store objectinformation or deal with managing the objects' lifetimes.

For example, the resources that maintain part of the graph that is notneeded (e.g., corresponds to visual information that has been clipped orscrolled off the screen) may be reclaimed, with the applicationrequested to redraw the scene if later needed. Thus, generally when acontainer is opened its contents are cleared and forgotten. If thosecontents do not have identity, then they may safely disappear so thatthe resources for them can be reclaimed by the system. If the higherlevel code 202 or some other part of the graph is holding onto childcontainers, those containers stay around and can be reinserted. However,this pattern can be changed and adapted depending on the needs of thehigher level code 202.

Thus, to summarize, the container is an object that has identity in thatthe high level program code using the data structure can hold a handleto that object. The opposite of an object with identity is plain data,and while the user code may employ a mental model that treats the datawithout identity as an object, once this data is committed to the systemthere is no way to later reference that object. In this manner, theobject can be transformed and changed in ways that are convenient to thesystem.

As a simplified example, an API function for drawing a line of textmight include a TextLine object. The user of this object would prime theTextLine object with the actual text to be drawn, along with the otherinformation on how to render different runs of that text (font, size,brush, and so forth). When the user program code wants to actually addthat line of text to the data structure, the program code may take adrawing context for a particular open node, and pass the TextLine objectinto a drawing function on the drawing context. The system in effecttakes the data that is in that TextLine object and copies the data intothe data structure. Because this data does not have identity, thehigh-level compositor and animator engine 206 is free to take thecontents of that line, run algorithms (e.g., OpenType) to break the textdown to glyphs with positions, and store the positioned glyph datainstead of the raw text. After that line was drawn the system would haveno reference to the TextLine object that was used to draw the line,i.e., the data that the system stores does not have any identity.

Alternatively, the higher level code 202 may request that identity bepreserved on that TextLine object, requiring the storing of a referenceto that object in the data structure. In this manner, if the higherlevel code 202 later changes the TextLine object, the system willdiscover that change and reflect it in the rendered output. Note that ina more realistic example, identity would not be exposed on the text lineobject itself, but rather the application would hold a handle to acontainer and make changes as desired by parameterizing that container,as described in the aforementioned U.S. Patent Application entitled“Generic Parameterization for a Scene Graph.” Nevertheless, one of themain aspects of the data structure is to reduce the need for the higherlevel code 202 to create such objects with identity, whereby a reducednumber of points in the data structure will be referenced by thecontrolling code 202. This enables more optimization of the datastructure.

For example, because of the reduction in the amount of identity exposedoutside of the data structure, an optimization such as the dense storageof primitives is enabled. To this end, vector graphic data is stored ina “primitive list” or primitive container. These containers areimplementation specific and are not exposed with identity to thehigher-level code 202. When the caller writes data into a container,that data is either stored in separate objects that are linked in, likethe containers, (e.g., with transforms), or can be streamed into apacked and flattened data array. This array may not only store thevector graphic data in a compact way, but may also track the resourcesthat go along with those primitives. Because the individual primitivesdo not have identity, there is no need to separate the primitives out orprovide a way for the user to change those primitives later, enablingmore efficient storage of the primitives.

As another optimization, when a sub-graph is not changing, it ispossible to store a bitmap of the contents of that tree, and attach thebitmap to a container, thereby reducing the amount of high-levelprocessing needed. Further, when a sub-graph or part of a primitive listrequires significant processing before it can be passed to a lower-levelcode for rendering, (e.g. tessellation of vector graphics before beinghanded off to a hardware device), the post-processed result may becached for later reuse.

Moreover, since there is no exposure of the structure except forspecific read operations (described below), the data structure is freeto reorganize containers so long as the rendered result is the same. Acontainer may therefore store the child container's in a spacepartitioning tree to optimize rendering and other read operations.Further, the data structure may be displayed multiple times on the samedevice or on multiple devices. For this reason the caches may be keyedbased on device if they are device dependent. If a subtree is recognizedas being static, repainted often because of animations around it and yetis dense enough to warrant the resource drain, a cache node may beautomatically inserted for that sub-tree.

For rendering, the data structure is read (either at some scheduled timeor by a different thread) and processed information of some form ispassed to the lower-level animator and compositor 210. To this end, inone alternative implementation, a render object and thread (per process)422 traverses the data structure 300 to drive the render process. Inanother alternative, instead of running on its own thread, the renderprocess may share time on a common thread with the rest of the user'scode in a type of “cooperative multi-tasking” arrangements The datastructure 300 can be used for direct rendering, although preferably itis compiled into the visual information that is fed to the lower-levelcomponents for very fast compositing and animation. The data structure300 can also be compiled in different ways, such as to be sent across anetwork to a remote terminal, to a printer and/or serialized to disk orsome other more permanent storage medium for interchange or caching.

In one alternative implementation, the data structure 300 is read forrendering on another thread 422. However, it should be noted that theuse of another thread is not a requirement, e.g., the “render thread”may alternatively comprise a cooperative sharing mechanism that runs onthe same thread as everything else. In the alternative model that uses arendering process/thread, the rendering thread runs as needed to providethe intended effect.

In keeping with the present invention, each time the thread runs, itfirst applies any pending changes that are in the change queue 418. Therender thread 422 then walks the data structure 300 to collectinformation such as bounding boxes and collect invalidations (describedbelow). Lastly it walks the areas that have changed since last time orneed to be rendered for some other reason, and executes the renderinginstructions that are stored in the data structure. Note that in thealternative model that does not use the change queue, changes areapplied directly, as they are being made, and thus do not need to beapplied here.

Thus, rendering from the data structure 300 is a multiple pass processwhich may run on a separate render thread 422, including a pass thatapplies queued changes made to the data structure, a pass thatpre-computes including iterating the data structure and computing datarequired for rendering such as bounding boxes, animated parametervalues, and so forth, and a render pass. The render pass renders basedon the abstract device 302, e.g., that will ultimately delegate to thelow-level compositor and animator 210. During the render pass,intermediate cached resources 426 can be cached in order to improverendering performance on subsequent frames.

Possible results of the last walk of the data structure include that thedata is executed directly and displayed on the screen, or executed on aback buffer that is flipped at the end of the last walk. Other resultsinclude the data being brought together with extended timing andanimation information (as described in the aforementioned U.S. PatentApplication entitled “Multiple-Level Graphics Processing System andMethod”) and passed down to a rendering thread/process that runs muchmore frequently. The walk may also result in data being executed onto abitmap for a screen capture or other reasons, directed to a printer, ordirected across a network and then used for any of the previous reasonson the remote machine. A combination of these results is also possible.

As can be appreciated, storage of the data in the data structure 300 mayrequire a large amount of memory. Further, much of the data in the datastructure 300 may not be needed because it is not visible, due toclipping, scrolling or other reasons. In accordance with another aspectof the present invention, to reduce resource demand, the data structure300 can be built on demand. To enable this, there is provided a methodfor calling back to the higher level code 202 in order to createportions of the data structure 300 as needed. This method has beenreferred to as “invalidation” and is similar to the WM_PAINT callbackmethod used in conventional graphics systems, but applies to thestructure 300 and cached contents instead of applying directly to bitson the screen. However, in one queue model alternative, read operations(like hit testing and coordinate transformation, described below) applychanges first, so the model presented to the user is synchronous.

Containers (e.g., the container 508 of FIG. 5) can be made invalid whenthey are created, when content is thrown away by the system because oflow resources, or when the higher level code directly requests for thecontainer to be made invalid. For example, the higher level code 202 cancreate a container, and provide a graphical size defining where and howbig that container is to be. During a render operation, if thatcontainer was marked as invalid but is now determined to be needed, therender thread 422 will ask the higher level code 202 to fill in thecontainer. The render thread 422 can wait for the higher level code 202to complete the request, or continue the render without the data that isneeded. The first option is not ideal, but may be necessary under somecircumstances. In certain situations, it may be desirable to have theapplication tell the higher level code 202 what it wants to put in thecache as soon as possible, essentially pre-filling the cache.

When the data is eventually filled in, the render thread 422 will runagain to display those new changes. In one current implementation, therequest to fill in a container is placed in another queue to get back tothe thread running the higher-level code 202. However this may be doneother ways, including a synchronous call to the higher level code 202 onthe same thread on which the renderer is running. However, making anysuch call synchronous will stall the rendering thread.

In addition to queuing updates to the data structure 300, there is aneed to provide for services to read back from the data structure 300.Such services include hit testing, point transformations and sub-graphsizing.

Hit testing is a process whereby a point is given in the coordinatespace of some root of the data structure, and the data structure isprobed such that the containers or primitives that are hit by that pointare returned. In a current implementation, the hit testing process iscontrolled by the values of three flags stored on each container,(although additional flags are feasible). A first flag includes asetting that instructs the hit test algorithm to stop and return the hittest results collected thus far. A second flag includes a setting thattells the hit testing algorithm to include that container in the resultlist if the point being hit does indeed hit that container. A third flagcontrols whether or the children of that container should be hit testedagainst.

Another read service is point transformation, wherein given two nodesconnected through the graph, there is a service whereby a point in thecoordinate frame of one container can be converted to the coordinateframe of another container. There are three general subtypes, includingtransforming from an ancestor to a descendent, from a descendent to anancestor and from peer to peer (any arbitrary node to any otherarbitrary node). The read service thus provides a way to query the datastructure for coordinate transforms, and leverages the tree architectureto walk up and compute the transform. Animation/changes may be lockedwhile doing multiple transforms, and performing transforms through acommon ancestor may be provided.

Another read service is sub-graph sizing. Given a node, this servicereturns the graphical size of that node and its sub-graph. This may bein the form of a size that is guaranteed to be large enough to containthe sub-graph, some perhaps different size that is just large enough tocontain the sub-graph, or a more complex shape detailing the contours ofthe sub-graph.

An implementation may want to synchronize these read operations withchanges to the data structure. To this end, if the change queue isapplied before any of these read operations are called, a moreconsistent view is presented to the higher level code.

The Low-level Compositor and Animator

As described above, the high-level engine 206 can intelligently compileand/modify the caching data structure 300 of the present invention for anumber of purposes, and can tailor its output to a number of possiblereceiving entities, including direct rendering to a display, printing,bitmap capture, remote network communication and so forth. One of thepossible receivers of this output is the low-level animator andcompositing engine 210. Although not necessary to the present invention,an example of the low-level animator will be described herein forpurposes of explaining operation of the intelligent caching datastructure as used with the high-level animator and compositing engine206. It is understood, however, that this is only one example, and thatthe output or other suitably formatted output may be provided to otherreceiving entities.

A primary purpose of the low-level animator and compositing engine 210is to provide an abstraction of the low-level rendering stack of themedia integration layer 200, which allows for high frame rate animationfor client graphics applications, the implementation of windowmanagement-like support, and support for remoting graphics services overa network connection. As represented in FIGS. 6 and 7, the low-levelanimator and compositing engine 210 may be arranged as a compositingengine server 600 that coordinates high frame rate animation requestsreceived from multiple clients (e.g., corresponding to applications) byusing services provided by a collection of renderers 602. The renderers602 generate rendering actions that act on rendering abstractions (alsoreferred to as visuals) implemented by a graphics compositing engine606.

The low-level animator and compositing engine 210 also provides toplevel visual management support, comprising infrastructure aimed atallowing a special client (a top level visual manager 604) to manipulatevisuals used by client applications as rendering areas on the screen.Each of the client applications 202 ₁–202 ₃ (only three are shown inFIG. 7, but there may be any number) rendering to the rendering stackowns a top level visual (TLV₁–TLV₃, respectively), and the top levelvisual manager 604 is a client that has authority over the layout of toplevel visuals on the screen. In general, the low-level animator andcompositing engine 210 composes the desktop by combining command streamsemitted by the various clients present on the desktop into graphicscommands consumed by the graphics compositing engine 606. The low-levelanimator and compositing engine 210 also helps the components that useit to implement a rendering architecture that makes programming userinterfaces for remote machines 610 ₁–610 _(n) the same as for localmachines.

FIG. 7 shows the interaction between the low-level animator andcompositing engine (server) 210 and its clients. As described above, thetop level visual manager 604 is also a client. As also described above,clients 202 ₁–202 ₃ of the low-level animator and compositing engine 210use an instance of a high-level compositor and animation engine 206 tobuild graphics structures and convert these into a stream of graphicscommands that the low-level animator and compositing engine 210 uses tocompose the viewed desktop. In one embodiment, there is only onelow-level animator and compositing engine 210, handling command streamsissued by clients (e.g., high level compositors) running on either thelocal or a remote machine.

Returning to FIG. 6, interprocess communication may be performed via aproperty system 614 maintained by the low-level animator and compositingengine (server) 210. Properties associated with each top level visualare stored by this property system 614. Clients can write and read theseproperties, and clients can be notified on request of changes toproperty values.

The low-level animator and compositing engine 210 provides client-servercommunication, fast animation rendering, and top level visual managementsupport. In one implementation, communication between the low-levelanimator and compositing engine 210 and clients occurs via a singlebidirectional byte stream and/or shared memory. For the byte stream,local clients use interprocess communication, while remote clients opena network byte stream connection. The byte stream is a transport layerfor a communication protocol that controls client server interaction.

The communication protocol includes three primary messages, namelyrequest, reply and event messages. Error messages are also provided. Theclient-to-server communication primarily comprises renderinginstructions, while the server-to-client communication is primarilyfeedback, in the form of responses and error messages, as describedbelow.

A request is generated by the client to the server, and may include toplevel visual management commands, rendering instruction commands andtiming interval commands. A reply may be sent by the server to theclient in response to a request. It should be noted, however, that notall requests are answered with replies; replies are generated only inresponse to appropriate requests that seek information. For example,draw instructions do not need a reply. However, a “Get window size”request needs and receives a reply.

An event is sent from the server to the client and contains informationabout a device action or about a side effect of a previous request. Forexample, the server can communicate an event message to the client forresource invalidation, and also to inform the client of a target framerate. The ability to communicate target frame rates enables variableframe rates, which is desirable because it ensures a consistent framerate, rather than a high frame rate.

Errors may also be sent to the client. An error is like an event, but isgenerally handled differently by the client, e.g., to compensate for theerror.

Before a client can use the services provided by the low-level animatorand compositing engine 210, the client first establishes a connection tothe engine 210, via entry points provided by a connection manager 710(FIG. 7). The connection manager 710 allocates a communication object(e.g., 712 ₁) that encapsulates the bidirectional byte stream transportlayer for the client server protocol. It also allocates an instructionlist manager (e.g., 714 ₁) which keeps track of rendering instructionscoming over the instruction stream and associates them with the correctvisual.

Once a connection is established, the client 202 requests the creationof a top level visual. In response to the request, the low-levelanimator and compositing engine 210 creates the top level visual (e.g.,TLV₁) by using services provided by the graphics compositing engine 606.The visuals maintained by the low-level animator and compositing engine210 for its clients are organized in a tree structure 718. When a clientis done with the top level visual, it requests its destruction. Notethat a root node 720 is a special visual representing the background ofthe desktop, and the children of the root visual are top level visuals.

As represented in FIG. 7, one significant role of the low-level animatorand compositing engine 210 is to manage the rendering to the computerdesktop, which is accomplished by relying on the services of two othercomponents, namely the graphics compositing engine 606 and a collectionof renderers 602. The graphics compositing engine 606 provides low-levelcompositing services via rendering abstractions referred to as visuals.A visual is a rectangular rendering area that gets composed into thedesktop and which can be rendered via a set of APIs supplied by thegraphics compositing engine 606. When it is time to compose the desktop,a rendering pass manager 722 traverses the tree from left to right andfor each node uses the rendering component to render to the visuals.

In addition to lifetime management of top level visuals, the low-levelanimator and compositing engine 210 also supports top level visualadornment, essentially adding decorations around the top level visuals.Adornments 730 ₁–730 ₃ are visuals that render decorations supplied bythe top level visual manager in the form of rendering instruction lists.These visuals are children of the top level visual to which they belong.The client (e.g., application) can control adornments provided by thetop level visual manager by setting predefined properties on the toplevel visual.

The low-level animator and compositing engine 210 also supportsminimizing services for top level visuals, which can also be supplied bythe top level visual manager 604 in terms of rendering instructionlists. Top level visual positioning, sizing and Z-order are supported,as well as three-dimensional effects specified for visual manageractions, like visual close and minimize. Thus, although theimplementation is primarily described with respect to two-dimensionalgraphics, the system can be easily used for storing other types of mediaincluding three-dimensional graphics, video and audio.

As described above, the rendering instruction lists that the top levelvisual manager needs are generated by a high-level animator andcompositor 206. The low-level animator and compositing engine 210defines a set of top level visual actions that have default behaviors,such as minimize or close. If the top level visual manager 604 wants tocustomize such a behavior, it uses the high-level APIs to build adescription of the action it wants to replace. It then sends theinstruction stream for the action across to the low-level animator andcompositing engine 210. The low-level animator and compositing engine210 stores this description in its property system 614 and uses it whenthe client requests the specified action.

Top level visual decorations are performed with the use of the propertysystem 614. At startup the top level visual manager sends instructionlists, generated with the high level engine 206, describing top levelvisual manager decorations. Updates to these decorations are donethrough the property system 614, i.e., when the client wishes to updatea decoration, the client sets a named property to the desired value. Thelow-level animator and compositing engine 210 then notifies the toplevel visual manager 604 that a property has changed. In response, thetop level visual manager 604 reads the property and updates the geometryon the low-level animator and compositing engine 210.

As further described in the aforementioned U.S. Patent Applicationentitled “Generic Parameterization for a Scene Graph,” the instructionlists are parameterized, which generally means that the top level visualmanager 604 does not need to be involved in simple changes, such asmodifying the color of a graphical image. In such cases, the clientinstead sends down a new parameter (e.g., the new color), and thedecoration is re-rendered with the same instruction list, but using thedifferent parameter. This also provides the ability to store only onecopy for each decoration description.

FIG. 8 shows a logical structure of queues 801–804 that implement theclient-server communication channel. Timing intervals are embedded inthe animated rendering instructions. At render time, the low-levelanimator and compositing engine 210 passes the current time togetherwith the timing intervals to the renderers. In turn, the renderers usethe timing intervals to interpolate the correct parameters forrendering, as described below. The animated rendering instructions aremanaged by the instruction list manager 714 in response to instructioncommands received from the high-level clients. The instruction listmanager queues 714 the rendering instructions as they are received. Therendering queues are in Z-order, and the rendering pass manager 722consumes them at compose time.

In addition to queuing timed rendering instructions, the instructionlist manager 714 supports other operations, including emptying thequeues 801–804, removing instruction from the queues, adding instructionto the queues, replacing a queue with a new instruction list, andapplying a fixed time offset to the queues. A special case for timingcontrolled rendering is when only the visibility of a renderinginstruction is controlled. In such an event, the timing intervals can beused to control the lifetime of an instruction in the rendering queue.

There may be situations when a client needs nested visuals to properlyrender its contents, such as when video is present in a scene. Becausevideo updating is preformed by an independent rendering process, the lowlevel engine 210 relies on the graphics compositing engine compose thevideo and the geometry that overlaps it. This is accomplished bycreating new visuals contained in the client application's top levelvisual, which hides the asynchronous nature of video updating in thegraphics compositing engine's compositing pass. The overlapping geometrythat shares a visual needs has the same type of alpha behavior (perpixel or transparent).

Animation

In general, animation is accomplished by both the high-level compositorand animation engine 206 and the low-level compositor and animationengine 210. As described above, the media integration layer is dividedinto multiple graphics processing levels below the user interface orapplication level. The high-level engine 206 traverses the scene andupdates animation parameters with intervals for later interpolation, andpackages these simplified data structures into instructions that getpassed to the lower-level engine 210. This may be done in a synchronousand/or asynchronous manner. The interval data can be considered asincluding the timing endpoints, (start and end timing data), as well asthe parameterized values for the rendering instruction. Note that thehigh-level engine 204 can perform some or all of a requestedinterpolation, e.g., if an interpolation or other motion function is toocomplex for the lower-level engine 210 to handle, or the lower-levelcannot keep up with the processing demands placed thereon, thehigher-level engine can perform some or all of the calculations andprovide the lower-level with simplified data, instructions,tessellations, and so on to accomplish the desired result. In a typicalcase when the lower level does perform interpolations, for each frame ofanimation, the low-level engine 210 interpolates the parameter intervalsto obtain instantaneous values, and decodes the instructions intorendering commands executed by the graphics device. The graphics devicecomposes the final scene adding any video frames that might be presentin the scene. Other data also may be added, such as content protected bydigital rights management.

Communication between the high-level engine 206 and low-level engine 210is accomplished via an instruction stream. The high-level engine 206writes rendering instructions to the stream at its slower frequency, oron demand. The low-level engine 210 reads the stream for instructionsand renders the scene. Note that the low-level engine 210 may alsoobtain data needed to render the scene from other sources, such asbitmaps and the like from shared memory.

Thus, the high-level, (e.g., tick-on-demand) engine 210 updatesanimation parameters and traverses the scene data structures asinfrequently as possible while maintaining smooth animation. Thehigh-level engine 206 traverses the scene data-structures, computes aninterval describing each animated parameter for a period of time, andpasses these intervals and simplified parameterized drawing instructionsto the low-level engine 210. The parameter data includes start time, endtime, interpolator and interpolation data. By way of example, instead oferasing and redrawing an image so that it appears to move, thehigh-level compositor and animation engine 206 can instruct thelow-level compositor and animation engine 210 as to how the image shouldchange over time, e.g., starting coordinates, ending coordinates, theamount of time (interval) that the image should move between thecoordinates, and a motion function, e.g., linear. The low-levelcompositor and animation engine 210 will interpolate to determine newpositions between frames, convert these into drawing instructions thatthe graphics device can understand, and pass the commands to thegraphics device.

Each pass of the high-level engine 206 preferably provides sufficientdata for the low-level engine 210 to perform smooth animation overseveral frames. The length, in time, of the shortest interval may beused to determine the minimum frequency at which the high-level engine206 needs to run to maintain smooth animation. Scenes that are entirelystatic or only include simple animations that can be defined by a singleinterval only require that the high-level engine 206 run when changesare made to the scene by the calling program 202. Scenes containing morecomplicated animations, where the parameters can be predicted andaccurately interpolated for short periods, but still much greater thanthe hardware refresh rate, require that the high-level engine 206 run atrelatively infrequent intervals, such as on the order of once every halfseconds. Highly complex animations, where at least one parameter can notbe predicted, would require that the high-level engine 206 run morefrequently (until at an extreme the system would essentially degenerateto a single-level animation system).

The frequency at which the high-level engine 206 runs need not beuniform or fixed. For example, the high-level engine 206 can bescheduled to run at a uniform interval that is no larger than theminimum interval provided by an animate parameter in the scene.Alternatively, the minimum interval computed on each run of thehigh-level engine 206 may be used to schedule the next run, to ensurethat new data will be provided to the low-level engine 210 in a timelymanner. Similarly, when structural changes are made to the scene and/orits animated parameters, the frequency of the high-level engine 206 maybe run to ensure that the new scene is accurately animated.

The low-level (e.g., fast-tick) engine 210 is a separate task from thehigh-level engine 206. The low-level engine 210 receives the simplifiedparameterized drawing instructions and parameter intervals describingthe scene from the high-level engine 206. The low-level engine maintainsand traverses these data structures until new ones are provided by thehigh-level engine 206. The low-level engine may service multiplehigh-level engines 206, maintaining separate data structures for each.The one-to-many relationship between the low-level engine 210 andhigh-level engine 206 allows the system to smoothly animate multiplescenes simultaneously.

The low-level engine 210 interpolates instantaneous animation parametersbased on the high-level engine's provided intervals, updates drawinginstructions and renders the scene for every frame. The low-level engine210 task runs at a high priority on the system, to ensure that framesare ready for presentation at the graphics hardware screen refresh rate.The interpolations performed by the low-level engine 210 are thustypically limited to simple, fast functions such as linear, piecewiselinear, cubic spline and those of similar speed. The low-level engine210 runs at a regular frequency, or frame rate, that is an integraldivisor of the hardware refresh rate. Each frame rendered by thelow-level engine 210 will be displayed for a consistent number orrefreshes by the graphics hardware.

The high-level traversal process 902 occurs in multiple passes. In apre-compute pass, the first traversal of the tree 900 performscalculations needed for drawing. For example, bounding boxes arecalculated for each subtree, and animate values are updated. Asdescribed above, rather than a single instantaneous value, an animator1104 may provide an interval. The interval includes the start and endtimes, which type of interpolator to use, and the data for theinterpolation. The resources used by the display tree are then sent tothe low-level engine 210 for realization.

A second traversal packages the information describing the scene to besent to the low-level engine 210 for rendering. As represented in FIG.9, the high-level engine 206 accumulates instruction blocks 900 into asingle visual update block 902 for each top level visual (i.e., window).Instruction block subtrees that have not changed since the lasttraversal are not appended. Instruction blocks for subtrees with onlydeclarative animation changes will only include the variable block ofinterpolation information. Instruction blocks for subtrees that havebeen repositioned with a transformation only include the header.

The low-level engine 210 rendering thread (or process) runs in a loop,rendering and composing visuals at high-frame rate, ideally the refreshrate of the display. The loop applies any visual update blocks receivedfrom the high-level engine 206. Interpolated values for resources andwindows being drawn on this pass are updated. For each variable in theinstruction block's variable list, the instantaneous value for the nextframe is computed. Then, the loop iterates over the offsets to locationsin the instruction list where it is used, memory copying the new value.

Updated off-screen resources are rendered, although alternativelyresources could be rendered on their first use. Instruction lists foreach top level visual are rendered, and the data “blt-ed” to thedisplay, flipped, or otherwise arranged to cause each top level visualto be updated on screen.

Remote Transport

As described above, the high-level engine 206 produces related sets ofdata that are transported to the low-level engine 210, includingresources such as images and text glyphs, animation intervals/variablesthat describe how a variable used for rendering changes over a shortperiod of time along with information on where it is used, andinstruction lists that describe the positioning rendering operationsrequired to render a top-level visual (window). Instruction lists cancontain references to variables in place of static values.

First, the high-level engine 206 creates the resources, which need to becreated before use, and are referenced by opaque handles in instructionlist. The high-level engine 206 creates resources by first creating adevice independent representation of the resource. In the case of animage the representation is a full-frame bitmap or an encoded image in aformat such as JPEG. For communication, the high-level engine 206 thensubmits the resource data to a communication stub which assigns it aunique handle. The handle is generated in the high-level engine 206process and is unique only within that process.

Instruction lists, variables, time values and animation intervals worktogether. The instruction list describes the rendering and may containreferences to variables in place of static values. Animation intervalsdescribe how to vary the value of the variable over a short period oftime.

The high-level engine 206 collects instruction lists and animationintervals as part of its rendering pass. The high-level engine 206packages the rendering information into one or more instruction blocksper top-level visual (window). Each block represents a subtree of thegraph for a particular window. Each block contains a list of variablesthat affect the instruction list. The instruction lists maintained inthe high-level engine 206 include references to the variables used.These variable references are collected for each variable and convertedinto locations (offsets) in the instruction list that must be replacedby the instantaneous of the variable before rendering. These offsets arepackaged with the animation interval information for that block.

FIG. 9 shows visual update data structures. In general, the collectionof instruction blocks describing a window is collected into a visualupdate block 902, as described above. The update block is then packagedinto a packet in the same way as the resource described above. Updateblocks may be large and could be sent in multiple packets if that ismore efficient for the transport.

The low-level engine 210 has a normal priority thread that listens tothe transport stream and process packets as they arrive. The work ispreferably done on a separate thread from the render thread to ensurethe low-level engine 210 can render every refresh. The communicationthread parses each packet based on the operation code (opcode),high-level engine identifier (ID), object handle.

As can be readily appreciated, because graphics instructions are sentrather than individual graphics bits, the amount of data that needs tobe communicated between the high-level engine and low-level engine issignificantly reduced. As a result, the graphics instructions from thehigh-level processing system can be transmitted over a networkconnection to remote terminals, which each have a low-level processingsystem. The resultant graphics output can appear substantially the sameover a number of terminals, even though the bandwidth of the connectioncould not carry conventional graphics data.

CONCLUSION

As can be seen from the foregoing detailed description, there isprovided an intelligent caching data structure and mechanisms thatprovides numerous benefits over contemporary graphics mechanisms. Thedata structure enables data to be changed to conserve resources, batchedchanges to be applied, rendered in different ways for differentreceiving entities. Other data in the structure may be invalidated andcreated as needed by calling back to higher-level code that is creatingthe scene being cached, such that resources need not be allocated forunneeded portions of a scene.

While the invention is susceptible to various modifications andalternative constructions, certain illustrated embodiments thereof areshown in the drawings and have been described above in detail. It shouldbe understood, however, that there is no intention to limit theinvention to the specific forms disclosed, but on the contrary, theintention is to cover all modifications, alternative constructions, andequivalents falling within the spirit and scope of the invention.

1. In a computing environment, a system comprising, a cache thatmaintains visual information; a queue for maintaining changes to thevisual information as requested by higher level program code; aninterface to the cache through which the visual information is accessedby the program code, the program code accessing the visual informationvia the interface, including requesting access to a container in thecache; a drawing context that opens the container and provides a surfacethrough which the program code requests changes to data in thecontainer; a batching mechanism, the batching mechanism deferring thewriting of any change to the queue until at least the close of thecontainer, such that changes to the container occur as an atomicoperation; a rendering mechanism that applies the changes in the queueand traverses the cache to create an instruction stream based on thevisual information including the changes, wherein the renderingmechanism operates at a fixed rate.
 2. The system of claim 1 wherein atleast part of the batching mechanism is incorporated into a function ofthe drawing context.
 3. The system of claim 1 wherein the batchingmechanism defers the writing of any change to the queue until the closeof the container and the close of at least one other container.
 4. Thesystem of claim 1 wherein the contents of the container are cleared uponopening of the container.
 5. The system of claim 1 wherein the renderingmechanism operates on demand in response to change information being inthe queue.
 6. In a computing environment, a method comprising:maintaining a scene graph; receiving a first request to implement afirst change in a structure of the scene graph; receiving a secondrequest to implement a second change in the structure; implementing thechanges to the first and second data atomically by making the changesonly upon receipt of an instruction that requests implementation of thechanges, including writing change data to a change queue; applying thechanges in the change queue to the scene graph and traversing the scenegraph to generate an instruction stream based on the scene graphincluding the changes to the structure, wherein applying the changes inthe change queue and the traversing of the scene graph occur at a firstoperating rate to provide the instruction stream to a low-levelcomponent, and executing the low-level component at a second operatingrate to provide drawing commands based on the instructions to a graphicssubsystem, the second operating rate being greater than the firstoperating rate and corresponding to a frame rate of the graphicssubsystem.
 7. The method of claim 6, wherein implementing the changescomprises, writing change data to a change queue.
 8. The method of claim6, wherein the instruction that requests implementation of the changescorresponds to a close command.
 9. The method of claim 6 wherein thestructure comprises a container, and further comprising, receiving acommand to open the container prior to receiving the first and secondrequests.
 10. The method of claim 9, wherein the instruction thatrequests implementation of the changes corresponds to a command to closethe container.
 11. The method of claim 9, further comprising, openingthe container and clearing the instructions.
 12. The method of claim 6further comprising, receiving an access request to access the structure,and returning a drawing context in response to the access request. 13.The method of claim 6 wherein implementing the changes atomicallycomprises, making the changes based on receipt of the instruction andreceipt of at least one other instruction that corresponds to at leastone other structure in the scene graph.
 14. A computer-readable mediumhaving computer-executable instructions, comprising: maintaining a scenegraph; receiving a first request to implement a first change in astructure of the scene graph; receiving a second request to implement asecond change in the structure; and implementing the changes to thefirst and second data atomically by making the changes only upon receiptof an instruction that requests implementation of the changes, includingwriting change data to a change queue; applying the changes in thechange queue to the scene graph and traversing the scene graph togenerate an instruction stream based on the scene graph including thechanges to the structure; wherein the changes in the change queue andthe traversing of the scene graph occur at a first operating rate toprovide the instruction stream to a low-level component, and executingthe low-level component at a second operating rate to provide drawingcommands based on the instructions to a graphics subsystem, the secondoperating rate being greater than the first operating rate andcorresponding to a frame rate of the graphics subsystem.
 15. Thecomputer-readable medium of claim 14, wherein implementing the changescomprises, writing change data to a change queue.
 16. Thecomputer-readable medium of claim 14, wherein the instruction thatrequests implementation of the changes corresponds to a close command.17. The computer-readable medium of claim 14 wherein the structurecomprises a container, and having at least one furthercomputer-executable instruction comprising, receiving a command to openthe container prior to receiving the first and second requests.
 18. Thecomputer-readable medium of claim 17, wherein the instruction thatrequests implementation of the changes corresponds to a command to closethe container.
 19. The computer-readable medium of claim 17, havingfurther computer-executable instructions comprising, opening thecontainer and clearing the instructions.
 20. The computer-readablemedium of claim 14 having further computer-executable instructionscomprising, receiving an access request to access the structure, andreturning a drawing context in response to the access request.
 21. Thecomputer-readable medium of claim 14 wherein implementing the changesatomically comprises, making the changes based on receipt of theinstruction and receipt of at least one other instruction thatcorresponds to at least one other structure in the scene graph.
 22. Acomputer-readable medium having computer-executable instructions,comprising: maintaining visual information in a cache data structureincluding container and data; reserving an invalid container for storinggraphics information, without having space allocated for the graphicsinformation; and rendering the data structure into data for receipt byanother entity at a fixed rate, including determining whether thegraphics information of the invalid container is needed, and if so: 1)allocating resources for the graphics information; 2) calling back tohigher-level program code to provide the graphics information; 3)receiving the graphics information; and 4) outputting the data forreceipt by another entity including information corresponding to thegraphics information received.
 23. The computer-readable medium of claim22 wherein reserving the invalid container comprises, marking acontainer as invalid and reclaiming space allocated for graphicsinformation.
 24. The computer-readable medium of claim 22 whereinreserving the invalid container comprises, receiving instructions fromthe higher-level program code to reserve an invalid container.
 25. Thecomputer-readable medium of claim 22 wherein outputting the data forreceipt by another entity includes, outputting an instruction stream fora low-level engine that converts the instruction stream to graphicsinformation understood by a graphics subsystem.
 26. Thecomputer-readable medium of claim 22 having further computer-executableinstructions comprising, waiting for the data from the higher-levelprogram code before completing the rendering of the cache datastructure.
 27. The computer-readable medium of claim 22 wherein callingback to higher-level program code comprises, queuing a request back to athread executing the higher-level program code.
 28. A computer-readablemedium having computer-executable components, comprising: a cache thatmaintains visual information; a queue for maintaining changes to thevisual information as requested by higher level program code; aninterface to the cache through which the visual information is accessedby the program code, the program code accessing the visual informationvia the interface, including requesting access to a container in thecache; and a drawing context that opens the container and provides asurface through which the program code requests changes to data in thecontainer, and a batching mechanism, the batching mechanism deferringthe writing of any change to the queue until at least the close of thecontainer, such that changes to the container occur as an atomicoperation; and a rendering mechanism that operates at a fixed rate andapplies the changes in the queue and traverses the cache to create aninstruction stream based on the visual information including thechanges.
 29. The computer-readable medium of claim 28 wherein at leastpart of the batching mechanism is incorporated into a function of thedrawing context.
 30. The computer-readable medium of claim 28 whereinthe batching mechanism defers the writing of any change to the queueuntil the close of the container and the close of at least one othercontainer.
 31. The computer-readable medium of claim 28 wherein thecontents of the container are cleared upon opening of the container. 32.The computer-readable medium of claim 27 claim 28 wherein the renderingmechanism operates on demand in response to change information being inthe queue.
 33. In a computing environment, a system comprising, a cachethat maintains visual information; a queue for maintaining changes tothe visual information as requested by higher level program code; aninterface to the cache through which the visual information is accessedby the program code, the program code accessing the visual informationvia the interface, including requesting access to a container in thecache; a drawing context that opens the container and provides a surfacethrough which the program code requests changes to data in thecontainer; a batching mechanism, the batching mechanism deferring thewriting of any change to the queue until at least the close of thecontainer, such that changes to the container occur as an atomicoperation; and a rendering mechanism that applies the changes in thequeue and traverses the cache to create an instruction stream based onthe visual information including the changes, wherein the renderingmechanism comprises a high-level component that executes at a firstoperating rate to provide the instruction stream to a low-levelcomponent, wherein the low-level component runs at a second operatingrate to provide drawing commands based on the instructions to a graphicssubsystem, and wherein the second operating rare is greater than thefirst operating rate and corresponds to a frame rate of the graphicssubsystem.
 34. The system of claim 33 wherein at least part of thebatching mechanism is incorporated into a function of the drawingcontext.
 35. The system of claim 33 wherein the batching mechanismdefers the writing of any change to the queue until the close of thecontainer and the close of at least one other container.
 36. The systemof claim 33 wherein the contents of the container are cleared uponopening of the container.
 37. The system of claim 33 wherein therendering mechanism operates on demand in response to change informationbeing in the queue.
 38. A computer-readable medium havingcomputer-executable instructions, comprising: maintaining visualinformation in a cache data structure including containers and data;reserving an invalid container for storing graphics information, withouthaving space allocated for the graphics information; and rendering thedata structure into data for receipt by another entity includingexecuting a high-level component at a first operating rate to provide aninstruction stream to a low-level component, the low-level componentrunning at a second operating rate to provide drawing commands based onthe instructions to a graphics subsystem, wherein the second operatingrate is greater than the first operating rate and corresponds to a framerate of the graphics subsystem, including determining whether thegraphics information of the invalid container is needed, and if so: 2)allocating resources for the graphics information; 2) calling back tohigher-level program code to provide the graphics information; 3)receiving the graphics information; and 4) outputting the data forreceipt by another entity including information corresponding to thegraphics information received.
 39. The computer-readable medium of claim38 wherein reserving the invalid container comprises, marking acontainer as invalid and reclaiming space allocated for graphicsinformation.
 40. The computer-readable medium of claim 38 whereinreserving the invalid container comprises, receiving instructions fromthe higher-level program code to reserve an invalid container.
 41. Thecomputer-readable medium of claim 38 wherein outputting the data forreceipt by another entity includes, outputting an instruction stream fora low-level engine that converts the instruction stream to graphicsinformation understood by a graphics subsystem.
 42. Thecomputer-readable medium of claim 38 having further computer-executableinstructions comprising, waiting for the data from the higher-levelprogram code before completing the rendering of the cache datastructure.
 43. The computer-readable medium of claim 38 wherein callingback to higher-level program code comprises, queuing a request back to athread executing the higher-level program code.
 44. A computer-readablemedium having computer-executable components, comprising: a cache thatmaintains visual information; a queue for maintaining changes to thevisual information as requested by higher level program code; aninterface to the cache through which the visual information is accessedby the program code, the program code accessing the visual informationvia the interface, including requesting access to a container in thecache; and a drawing context that opens the container and provides asurface through which the program code requests changes to data in thecontainer; and a batching mechanism, the batching mechanism deferringthe writing of any change to the queue until at least the close of thecontainer, such that changes to the container occur as an atomicoperation; and a rendering mechanism comprising a high-level componentthat executes at a first operating rate to provide an instruction streamto a low-level component, wherein the low-level component rims at asecond operating rate to provide drawing commands based on theinstructions to a graphics subsystem, and wherein the second operatingrate is greater than the first operating rate and corresponds to a framerate of the graphics subsystem.
 45. The computer-readable medium ofclaim 44 wherein at least part of the batching mechanism is incorporatedinto a function of the drawing context.
 46. The computer-readable mediumof claim 44 wherein the batching mechanism defers the writing of anychange to the queue until the close of the container and the close of atleast one other container.
 47. The computer-readable medium of claim 44wherein the contents of the container are cleared upon opening of thecontainer.
 48. The computer-readable medium of claim 44 having at leastone further computer-executable component comprising a renderingmechanism that applies the changes in the queue and traverses the cacheto create an instruction stream based on the visual informationincluding the changes.
 49. The computer-readable medium of claim 44wherein the rendering mechanism operates on demand in response to changeinformation being in the queue.